<template>
  <div class="todo-header">
    <input type="text" placeholder="请输入你的任务名称，按回车键确认" v-model="title" @keyup.enter="addOneTodo(title)"/>
  </div>
</template>

<script>
export default {
  name: "Header",
  props:['addTodo'],
  data(){
    return {
      title:''
    }
  },
  methods:{
    addOneTodo(title){
      this.addTodo(title)
      this.title = ''
    }
  }
}
</script>

<style scoped>
@import "@/assets/css/Header.css";
</style>